
<%@ page import="hc.uco.Paciente" %>
<%@ page import="hc.uco.Medicacao" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'paciente.label', default: 'Paciente')}" />
        <title><g:message code="default.show.label" args="[entityName]" /></title>
        <g:set var="startYear" value="${(1800 + (new Date().year))}" />
        <g:set var="endYear" value="${(1900 + (new Date().year))}" />
        <g:set var="dateFormat" value="%d/%m/%Y" />
        <g:set var="dateTimeFormat" value="%d/%m/%Y %H:%M" />
        <g:set var="defaultDate" value="${new GregorianCalendar(1900 + (new Date().year),0,1,12,30,0)}" />
    </head>
    <body>
       <g:render template="/mainbar" />
        <div class="body">
            <h1>Paciente: ${fieldValue(bean: pacienteInstance, field: "nome")}</h1>
            <g:render template="/pacientebar" />
            <div class="dialog">
                <g:render template="/pacienteheader" />
             </div>
                <g:if test="${flash.message}"><div class="message">${flash.message}</div></g:if>
                <h2><g:message code="historiaPregressa.titulo" /></h2>
	            <g:hasErrors bean="${historiaPregressaInstance}">
	            <div class="errors">
	                <g:renderErrors bean="${historiaPregressaInstance}" as="list" />
	            </div>
            	</g:hasErrors>
            	<g:if test="${flash.errors}">
            	<div class="errors">
	                <g:renderErrors bean="${flash}" as="list" />
	            </div></g:if>
	            <g:javascript>
		            function checkIam(status){
		            	if(status)
		            		$("#iamTable").show();
		            	else
		            		$("#iamTable").hide();
		            }
		            
		            function checkAngio(status){
		            	if(status)
		            		$("#angioTable").show();
		            	else
		            		$("#angioTable").hide();
		            }
		            
		            function checkAngio2(status){
		            	if(status)
		            		$("#angio2Table").show();
		            	else
		            		$("#angio2Table").hide();
		            		$("#angio3Table").hide();
		            		$("#angio4Table").hide();
		            		$("#angio5Table").hide();
		            }
		            
		            function checkAngio3(status){
		            	if(status)
		            		$("#angio3Table").show();
		            	else
		            		$("#angio3Table").hide();
		            		$("#angio4Table").hide();
		            		$("#angio5Table").hide();
		            }
		            
		            function checkAngio4(status){
		            	if(status)
		            		$("#angio4Table").show();
		            	else
		            		$("#angio4Table").hide();
		            		$("#angio5Table").hide();
		            }
		            
		            function checkAngio5(status){
		            	if(status)
		            		$("#angio5Table").show();
		            	else
		            		$("#angio5Table").hide();
		            }
		            
		            function checkInsuf(status){
		            	if(status)
		            		$("#insufTable").show();
		            	else
		            		$("#insufTable").hide();
		            }
		            
		            function checkAngina(status){
		            	if(status)
		            		$("#anginaTable").show();
		            	else
		            		$("#anginaTable").hide();
		            }
		            
		            function checkDmi(status){
		            	if(status)
		            		$("#dmiTable").show();
		            	else
		            		$("#dmiTable").hide();
		            }
		            
		            function checkDmii(status){
		            	if(status)
		            		$("#dmiiTable").show();
		            	else
		            		$("#dmiiTable").hide();
		            }
		            
		            function checkHas(status){
		            	if(status)
		            		$("#hasTable").show();
		            	else
		            		$("#hasTable").hide();
		            }
		            
		            function checkChagas(status){
		            	if(status)
		            		$("#chagasTable").show();
		            	else
		            		$("#chagasTable").hide();
		            }
		            
		            function checkTabagista(status){
		            	if(status)
		            		$("#tabagistaTable").show();
		            	else
		            		$("#tabagistaTable").hide();
		            }
		            
		            function checkExTabagista(status){
		            	if(status)
		            		$("#exTabagistaTable").show();
		            	else
		            		$("#exTabagistaTable").hide();
		            }
		            
		            function checkAvc(status){
		            	if(status)
		            		$("#avcTable").show();
		            	else
		            		$("#avcTable").hide();
		            }
		            
		            function checkRvm(status){
		            	if(status)
		            		$("#rvmTable").show();
		            	else
		            		$("#rvmTable").hide();
		            }
		            
		            function checkTrombolise(status){
		            	if(status)
		            		$("#tromboliseTable").show();
		            	else
		            		$("#tromboliseTable").hide();
		            }
		            
		            function checkAtc(status){
		            	if(status)
		            		$("#atcTable").show();
		            	else
		            		$("#atcTable").hide();
		            }
		            
		            function checkAtcComplementar(status){
		            	if(status)
		            		$("#atcComplementarTable").show();
		            	else
		            		$("#atcComplementarTable").hide();
		            }
		            
		            function checkSupra(status){
		            	if(status)
		            		$("#supraTable").show();
		            	else
		            		$("#supraTable").hide();
		            }
		            
		            function checkInfra(status){
		            	if(status)
		            		$("#infraTable").show();
		            	else
		            		$("#infraTable").hide();
		            }
		            
		            function checkInversao(status){
		            	if(status)
		            		$("#inversaoTable").show();
		            	else
		            		$("#inversaoTable").hide();
		            }
		            
		            function checkDelta(status){
		            	if(status)
		            		$("#deltaTable").show();
		            	else
		            		$("#deltaTable").hide();
		            }
		            
		            
	            </g:javascript>
            <g:form method="post" >
                <g:hiddenField name="id" value="${historiaPregressaInstance?.id}" />
                <g:hiddenField name="version" value="${historiaPregressaInstance?.version}" />
                <g:hiddenField name="paciente.id" value="${pacienteInstance?.id}" />
                <div class="dialog">
                    <table>
                        <tbody>
                        	 <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'iam', 'errors')}">
                                   	<g:checkBox name="iam" id="iam" value="${historiaPregressaInstance?.iam}" onclick="checkIam(this.checked)"  /> <label for="iam"><g:message code="historiaPregressa.iam.label" default="IAM" /></label>
                                </td>
                                
                                <td colspan="3">
                                	<table <g:if test="${historiaPregressaInstance?.iam != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" name="iamTable" id ="iamTable"  >
                                	<tr>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'iamData1', 'errors')}" nowrap="nowrap">
		                                    1. <calendar:datePicker name="iamData1" value="${historiaPregressaInstance?.iamData1}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'iamData2', 'errors')}" nowrap="nowrap">
		                                    2. <calendar:datePicker name="iamData2" value="${historiaPregressaInstance?.iamData2}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'iamData3', 'errors')}" nowrap="nowrap">
		                                    3. <calendar:datePicker name="iamData3" value="${historiaPregressaInstance?.iamData3}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                </td>
	                                </tr>
	                                </table>
	                          	</td>
                            </tr>
                            
                            <tr class="">
                                <td valign="top" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastia', 'errors')}">
                                    <g:checkBox name="angioplastia" value="${historiaPregressaInstance?.angioplastia}" onclick="checkAngio(this.checked)" /> <label for="angioplastia"><g:message code="historiaPregressa.angioplastia.label" default="Angioplastia" /></label>
                                </td>
                                <td colspan="3">
                                	<table <g:if test="${historiaPregressaInstance?.angioplastia != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" name="angioTable" id="angioTable">
                                	<tr>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastiaData1', 'errors')}">
		                                    <calendar:datePicker name="angioplastiaData1" value="${historiaPregressaInstance?.angioplastiaData1}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stent1', 'errors')}">
		                                    <g:checkBox name="stent1" value="${historiaPregressaInstance?.stent1}" /> <g:message code="historiaPregressa.stent.label" default="Stent" />
		                                </td>
		                                <td valign="middle" class="value ${hasErrors(bean: historiaPregressaInstance, field: 'stentPrimEle1', 'errors')}">
		                                    <label for="stentTipo1"><g:message code="historiaPregressa.stentTipo.label" default="Tipo" /></label>: <g:select name="stentPrimEle1" from="${historiaPregressaInstance.constraints.stentPrimEle1.inList}" value="${historiaPregressaInstance?.stentPrimEle1}" valueMessagePrefix="historiaPregressa.stentPrimEle1" noSelection="['': '']"  />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stentTipo1', 'errors')}">
		                                   <label for="stentTipo1"><g:message code="historiaPregressa.arteria.label" default="Arteria" /></label>: <g:select name="stentTipo1" from="${historiaPregressaInstance.arterias}" value="${historiaPregressaInstance?.stentTipo1}" valueMessagePrefix="historiaPregressa.stentTipo1" noSelection="['': '']"  />
		                                </td>
		                                <td valign="top" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastia2', 'errors')}">
						                    <g:checkBox name="angioplastia2" value="${historiaPregressaInstance?.angioplastia2}" onclick="checkAngio2(this.checked)" /> <label for="angioplastia"><g:message code="historiaPregressa.angioplastia.label" default="Adicionar Angioplastia" /></label>
					                  	</td>
	                                </tr>
	                                <tr name="angio2Table" id="angio2Table" <g:if test="${historiaPregressaInstance?.angioplastia2 != true}" > style="display:none" </g:if>>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastiaData2', 'errors')}">
		                                    <calendar:datePicker name="angioplastiaData2" value="${historiaPregressaInstance?.angioplastiaData2}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stent2', 'errors')}">
		                                    <g:checkBox name="stent2" value="${historiaPregressaInstance?.stent2}" /> <g:message code="historiaPregressa.stent.label" default="Stent" />
		                                </td>
		                                
		                                <td valign="middle" class="value ${hasErrors(bean: historiaPregressaInstance, field: 'stentPrimEle2', 'errors')}">
		                                    <label for="stentTipo2"><g:message code="historiaPregressa.stentTipo.label" default="Tipo" /></label>: <g:select name="stentPrimEle2" from="${historiaPregressaInstance.constraints.stentPrimEle2.inList}" value="${historiaPregressaInstance?.stentPrimEle2}" valueMessagePrefix="historiaPregressa.stentPrimEle2" noSelection="['': '']"  />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stentTipo2', 'errors')}">
		                                   <label for="stentTipo2"><g:message code="historiaPregressa.arteria.label" default="Arteria" /></label>: <g:select name="stentTipo2" from="${historiaPregressaInstance.arterias}" value="${historiaPregressaInstance?.stentTipo2}" valueMessagePrefix="historiaPregressa.stentTipo2" noSelection="['': '']"  />
		                                </td>
		                                <td valign="top" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastia3', 'errors')}">
						                    <g:checkBox name="angioplastia3" value="${historiaPregressaInstance?.angioplastia3 && historiaPregressaInstance?.angioplastia2}" onclick="checkAngio3(this.checked)" /> <label for="angioplastia"><g:message code="historiaPregressa.angioplastia.label" default="Adicionar Angioplastia" /></label>
					                  	</td>
	                                </tr>
	                                <tr name="angio3Table" id="angio3Table" <g:if test="${historiaPregressaInstance?.angioplastia3 != true || historiaPregressaInstance?.angioplastia2 != true || historiaPregressaInstance?.angioplastiaData1 == null}"> style="display:none" </g:if>>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastiaData3', 'errors')}">
		                                    <calendar:datePicker name="angioplastiaData3" value="${historiaPregressaInstance?.angioplastiaData3}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stent3', 'errors')}">
		                                    <g:checkBox name="stent3" value="${historiaPregressaInstance?.stent3}" /> <g:message code="historiaPregressa.stent.label" default="Stent" />
		                                </td>
		                                <td valign="middle" class="value ${hasErrors(bean: historiaPregressaInstance, field: 'stentPrimEle3', 'errors')}">
		                                    <label for="stentTipo3"><g:message code="historiaPregressa.stentTipo.label" default="Tipo" /></label>: <g:select name="stentPrimEle3" from="${historiaPregressaInstance.constraints.stentPrimEle3.inList}" value="${historiaPregressaInstance?.stentPrimEle3}" valueMessagePrefix="historiaPregressa.stentPrimEle3" noSelection="['': '']"  />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stentTipo3', 'errors')}">
		                                   <label for="stentTipo3"><g:message code="historiaPregressa.arteria.label" default="Arteria" /></label>: <g:select name="stentTipo3" from="${historiaPregressaInstance.arterias}" value="${historiaPregressaInstance?.stentTipo3}" valueMessagePrefix="historiaPregressa.stentTipo3" noSelection="['': '']"  />
		                                </td>
		                                <td valign="top" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastia4', 'errors')}">
						                    <g:checkBox name="angioplastia4" value="${historiaPregressaInstance?.angioplastia4 && historiaPregressaInstance?.angioplastia2 && historiaPregressaInstance?.angioplastia3}" onclick="checkAngio4(this.checked)" /> <label for="angioplastia"><g:message code="historiaPregressa.angioplastia.label" default="Adicionar Angioplastia" /></label>
					                  	</td>
	                                </tr>
	                                <tr name="angio4Table" id="angio4Table" <g:if test="${historiaPregressaInstance?.angioplastia4 != true || historiaPregressaInstance?.angioplastia2 != true || historiaPregressaInstance?.angioplastia3 != true}" >  style="display:none" </g:if>>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastiaData4', 'errors')}">
		                                    <calendar:datePicker name="angioplastiaData4" value="${historiaPregressaInstance?.angioplastiaData4}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stent4', 'errors')}">
		                                    <g:checkBox name="stent4" value="${historiaPregressaInstance?.stent4}" /> <g:message code="historiaPregressa.stent.label" default="Stent" />
		                                </td>
		                                <td valign="middle" class="value ${hasErrors(bean: historiaPregressaInstance, field: 'stentPrimEle4', 'errors')}">
		                                    <label for="stentTipo4"><g:message code="historiaPregressa.stentTipo.label" default="Tipo" /></label>: <g:select name="stentPrimEle4" from="${historiaPregressaInstance.constraints.stentPrimEle4.inList}" value="${historiaPregressaInstance?.stentPrimEle4}" valueMessagePrefix="historiaPregressa.stentPrimEle4" noSelection="['': '']"  />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stentTipo4', 'errors')}">
		                                   <label for="stentTipo4"><g:message code="historiaPregressa.arteria.label" default="Arteria" /></label>: <g:select name="stentTipo4" from="${historiaPregressaInstance.arterias}" value="${historiaPregressaInstance?.stentTipo4}" valueMessagePrefix="historiaPregressa.stentTipo4" noSelection="['': '']"  />
		                                </td>
		                                <td valign="top" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastia5', 'errors')}">
						                    <g:checkBox name="angioplastia5" value="${historiaPregressaInstance?.angioplastia5 && historiaPregressaInstance?.angioplastia4 && historiaPregressaInstance?.angioplastia2 && historiaPregressaInstance?.angioplastia3}" onclick="checkAngio5(this.checked)" /> <label for="angioplastia"><g:message code="historiaPregressa.angioplastia.label" default="Adicionar Angioplastia" /></label>
					                  	</td>
	                                </tr>
	                                <tr name="angio5Table" id="angio5Table" <g:if test="${historiaPregressaInstance?.angioplastia5 != true || historiaPregressaInstance?.angioplastia2 != true || historiaPregressaInstance?.angioplastia3 != true || historiaPregressaInstance?.angioplastia4 != true}">  style="display:none" </g:if>>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'angioplastiaData5', 'errors')}">
		                                    <calendar:datePicker name="angioplastiaData5" value="${historiaPregressaInstance?.angioplastiaData5}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stent5', 'errors')}">
		                                    <g:checkBox name="stent5" value="${historiaPregressaInstance?.stent5}" /> <g:message code="historiaPregressa.stent.label" default="Stent" />
		                                </td>
		                                <td valign="middle" class="value ${hasErrors(bean: historiaPregressaInstance, field: 'stentPrimEle5', 'errors')}">
		                                    <label for="stentTipo5"><g:message code="historiaPregressa.stentTipo.label" default="Tipo" /></label>: <g:select name="stentPrimEle5" from="${historiaPregressaInstance.constraints.stentPrimEle5.inList}" value="${historiaPregressaInstance?.stentPrimEle5}" valueMessagePrefix="historiaPregressa.stentPrimEle5" noSelection="['': '']"  />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'stentTipo5', 'errors')}">
		                                   <label for="stentTipo5"><g:message code="historiaPregressa.arteria.label" default="Arteria" /></label>: <g:select name="stentTipo5" from="${historiaPregressaInstance.arterias}" value="${historiaPregressaInstance?.stentTipo5}" valueMessagePrefix="historiaPregressa.stentTipo5" noSelection="['': '']"  />
		                                </td>
	                                </tr>
	                                </table>
	                         	</td>
                            </tr>
                            
                            <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'insuficienciaCardiaca', 'errors')}" nowrap="nowrap">
                                    <g:checkBox name="insuficienciaCardiaca" value="${historiaPregressaInstance?.insuficienciaCardiaca}" onclick="checkInsuf(this.checked)" /> <label for="insuficienciaCardiaca"><g:message code="historiaPregressa.insuficienciaCardiaca.label" default="Insuficiencia Cardiaca" /></label>
                                </td>
                                <td colspan="2">
                                	<table <g:if test="${historiaPregressaInstance?.insuficienciaCardiaca != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" width="30%" name="insufTable" id="insufTable">
                                	<tr>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'insuficienciaCardiacaTipo', 'errors')}">
		                                    <label for="insuficienciaCardiacaTipo"><g:message code="historiaPregressa.insuficienciaCardiacaTipo.label" default="Tipo" /></label>: 
		                                    <g:select name="insuficienciaCardiacaTipo" from="${historiaPregressaInstance.constraints.insuficienciaCardiacaTipo.inList}" value="${historiaPregressaInstance?.insuficienciaCardiacaTipo}" valueMessagePrefix="historiaPregressa.insuficienciaCardiacaTipo" noSelection="['': '']"  />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'insuficienciaCardiacaClasse', 'errors')}">
		                                    <label for="insuficienciaCardiacaClasse"><g:message code="historiaPregressa.insuficienciaCardiacaClasse.label" default="Classe" /></label>: 
		                                    <g:select name="insuficienciaCardiacaClasse" from="${historiaPregressaInstance.constraints.insuficienciaCardiacaClasse.inList}" value="${fieldValue(bean: historiaPregressaInstance, field: 'insuficienciaCardiacaClasse')}" valueMessagePrefix="historiaPregressa.insuficienciaCardiacaClasse" noSelection="['': '']" />
		                                </td>
                                	</tr>
	                                </table>
	                          	</td>
                            </tr>
                            
                            <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'anginaEstavel', 'errors')}" nowrap="nowrap">
                                    <g:checkBox name="anginaEstavel" value="${historiaPregressaInstance?.anginaEstavel}" onclick="checkAngina(this.checked)" /> <label for="anginaEstavel"><g:message code="historiaPregressa.anginaEstavel.label" default="Angina Estável" /></label>
                                </td>
                                <td colspan="1">
                                	<table <g:if test="${historiaPregressaInstance?.anginaEstavel != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" width="30%" name="anginaTable" id="anginaTable">
                                	<tr>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'anginaEstavelClasse', 'errors')}">
		                                    <label for="anginaEstavelClasse"><g:message code="historiaPregressa.anginaEstavelClasse.label" default="Classe" /></label>: 
		                                    <g:select name="anginaEstavelClasse" from="${historiaPregressaInstance.constraints.anginaEstavelClasse.inList}" value="${fieldValue(bean: historiaPregressaInstance, field: 'anginaEstavelClasse')}" valueMessagePrefix="historiaPregressa.anginaEstavelClasse" noSelection="['': '']" />
		                                </td>
                                	</tr>
	                                </table>
	                           	</td>
                            </tr>
                            
                            <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'cateEstenose', 'errors')}" nowrap="nowrap">
                                    <g:checkBox name="cateEstenose" value="${historiaPregressaInstance?.cateEstenose}" /> <label for="cateEstenose"><g:message code="historiaPregressa.cateEstenose.label" default="Cate Estenose maior que 50%" /></label>
                                </td>
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'dap', 'errors')}" nowrap="nowrap">
                                    <g:checkBox name="dap" value="${historiaPregressaInstance?.dap}" /> <label for="dap"><g:message code="historiaPregressa.dap.label" default="Doenca Arterial Periferica" /></label>
                                </td>
                            </tr>
                            
                            <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'dmi', 'errors')}">
                                    <g:checkBox name="dmi" value="${historiaPregressaInstance?.dmi}" onclick="checkDmi(this.checked)" /> <label for="dmi"><g:message code="historiaPregressa.dmi.label" default="DMI" /></label>
                                </td>
                                <td <g:if test="${historiaPregressaInstance?.dmi != true}" > style="display:none" </g:if> valign="middle" name="dmiTable" id="dmiTable" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'dmiAno', 'errors')}">
                                    <label for="dmiAno"><g:message code="historiaPregressa.dmiAno.label" default="Data Início" /></label>: <g:select name="dmiAno" from="${(1900 + (new Date().year))..(1800+(new Date().year))}" value="${historiaPregressaInstance?.dmiAno}" noSelection="['': '']" />
                                </td>

                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'dmii', 'errors')}">
                                    <g:checkBox name="dmii" value="${historiaPregressaInstance?.dmii}" onclick="checkDmii(this.checked)" /> <label for="dmii"><g:message code="historiaPregressa.dmii.label" default="DMII" /></label>
                                </td>
                                <td <g:if test="${historiaPregressaInstance?.dmii != true}" > style="display:none" </g:if> name="dmiiTable" id="dmiiTable"  valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'dmiiAno', 'errors')}">
                                    <label for="dmiiAno"><g:message code="historiaPregressa.dmiiAno.label" default="Data Início" /></label>: <g:select name="dmiiAno" from="${(1900 + (new Date().year))..(1800+(new Date().year))}" value="${historiaPregressaInstance?.dmiiAno}" noSelection="['': '']" />
                                </td>
                            </tr>
                        
                            <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'has', 'errors')}"> 
                                    <g:checkBox name="has" value="${historiaPregressaInstance?.has}" onclick="checkHas(this.checked)"/> <label for="has"><g:message code="historiaPregressa.has.label" default="HAS" /></label>
                                </td>
                                <td <g:if test="${historiaPregressaInstance?.has != true}" > style="display:none" </g:if> name="hasTable" id="hasTable" valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'hasAno', 'errors')}">
                                    <label for="hasAno"><g:message code="historiaPregressa.hasAno.label" default="Data Início" /></label>: <g:select name="hasAno" from="${(1900 + (new Date().year))..(1800+(new Date().year))}" value="${historiaPregressaInstance?.hasAno}" noSelection="['': '']" />
                                </td>
                               	<td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'chagas', 'errors')}" nowrap="nowrap">
                                    <g:checkBox name="chagas" value="${historiaPregressaInstance?.chagas}" onclick="checkChagas(this.checked)" /> <label for="chagas"><g:message code="historiaPregressa.chagas.label" default="Doen�a de Chagas" /></label>
                                </td>
                                <td <g:if test="${historiaPregressaInstance?.chagas != true}" > style="display:none" </g:if> name="chagasTable" id="chagasTable" valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'chagasAno', 'errors')}">
                                    <label for="chagasAno"><g:message code="historiaPregressa.chagasAno.label" default="Data Início" /></label>: 
                                    <g:select name="chagasAno" from="${(1900 + (new Date().year))..(1800+(new Date().year))}" value="${historiaPregressaInstance?.chagasAno}" noSelection="['': '']" />
                                </td>
                            </tr>
                        
                            <tr class="">
                                <td valign="middle" class="option">
                                  <g:checkBox name="tabagista" value="${historiaPregressaInstance?.tabagista}" onclick="checkTabagista(this.checked)" /> <label for="tabagista"><g:message code="historiaPregressa.tabagista.label" default="Tabagista" /></label>
                                </td>
                                <td>
                                	<table <g:if test="${historiaPregressaInstance?.tabagista != true}" > style="display:none" </g:if> name="tabagistaTable" id="tabagistaTable" class="transp" cellspacing="0" cellpadding="0" >
	                                	<tr>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'macosDia', 'errors')}">
	                                    <label for="macosDia"><g:message code="historiaPregressa.macosDia.label" default="Macos/Dia" /></label> <g:textField name="macosDia" value="${historiaPregressaInstance?.macosDia}" size="3"/>
	                               		</td>
	                               		<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'numAno', 'errors')}">
	                                    <label for="numAno"><g:message code="historiaPregressa.numAno.label" default="durante" /></label> <g:textField name="numAno" value="${historiaPregressaInstance?.numAno}" size="3"/> anos
	                                	</td>
	                                    </tr>
                                    </table>
                              	</td>

                               	<td valign="middle" class="option  ${hasErrors(bean: historiaPregressaInstance, field: 'exTabagista', 'errors')}">
                                  <g:checkBox name="exTabagista" value="${historiaPregressaInstance?.exTabagista}" onclick="checkExTabagista(this.checked)" /> <label for="exTabagista"><g:message code="historiaPregressa.exTabagista.label" default="Ex-tabagista" /></label>
                                </td>
                                <td <g:if test="${historiaPregressaInstance?.exTabagista != true}" > style="display:none" </g:if> name="exTabagistaTable" id="exTabagistaTable" valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'dataParada', 'errors')}">
                                    <label for="dataParada"><g:message code="historiaPregressa.dataParada.label" default="Data Parada" /></label> 
                                    <calendar:datePicker name="dataParada" value="${historiaPregressaInstance?.dataParada}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
                                </td>
                            </tr>
                            
                            <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'avc', 'errors')}">
                                    <g:checkBox name="avc" value="${historiaPregressaInstance?.avc}" onclick="checkAvc(this.checked)" /> <label for="avc"><g:message code="historiaPregressa.avc.label" default="Avc" /></label>
                                </td>

                                <td colspan="3">
                                	<table <g:if test="${historiaPregressaInstance?.avc != true}" > style="display:none" </g:if> name="avcTable" id="avcTable" class="transp" cellspacing="0" cellpadding="0" >
                                	<tr>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'avcData1', 'errors')}">
		                                    1. <calendar:datePicker name="avcData1" value="${historiaPregressaInstance?.avcData1}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'avcData2', 'errors')}">
		                                    2. <calendar:datePicker name="avcData2" value="${historiaPregressaInstance?.avcData2}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                </td>
                                	</tr>
                                	</table>
                                </td>
                            </tr>
                            
                            <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'rvm', 'errors')}">
                                    <g:checkBox name="rvm" value="${historiaPregressaInstance?.rvm}" onclick="checkRvm(this.checked)" /> <label for="rvm"><g:message code="historiaPregressa.rvm.label" default="RVM" /></label>
                                </td>
                                <td colspan="3">
                                	<table <g:if test="${historiaPregressaInstance?.rvm != true}" > style="display:none" </g:if> name="rvmTable" id="rvmTable" class="transp" cellspacing="0" cellpadding="0" >
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'rvmData', 'errors')}">
		                                    <calendar:datePicker name="rvmData" value="${historiaPregressaInstance?.rvmData}" dateFormat="${dateFormat}" weekNumbers="false" years="${startYear},${endYear}" />
		                                </td>
		                                <td valign="middle" class="name">
		                               		<label for="rvmEnxertos"><g:message code="historiaPregressa.rvmEnxertos.label" default="Enxertos" /></label>
		                                </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'rvmEnxertos', 'errors')}">
		                                    <g:textField name="rvmEnxertos" value="${historiaPregressaInstance?.rvmEnxertos}" />
		                                </td>
		                             </table>
	                             </td>
                            </tr>
                        
                            <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'sedentarismo', 'errors')}" colspan="2">
                                    <g:checkBox name="sedentarismo" value="${historiaPregressaInstance?.sedentarismo}" /> <label for="sedentarismo"><g:message code="historiaPregressa.sedentarismo.label" default="Sedentarismo" /></label>
                                </td>
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'histFamiliar', 'errors')}" colspan="2">
                                    <g:checkBox name="histFamiliar" value="${historiaPregressaInstance?.histFamiliar}" /> <label for="histFamiliar"><g:message code="historiaPregressa.histFamiliar.label" default="Hist. Familiar (AVC, IAM, MS em Pai<55 anos ou irmão, Mãe ou irmã<65 anos)" /></label>
                                </td>
                            </tr>
                        
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="outros"><g:message code="historiaPregressa.outros.label" default="Outros" /></label>
                                </td>
                                <td valign="middle" class="value ${hasErrors(bean: historiaPregressaInstance, field: 'outros', 'errors')}" colspan="3">
                                    <g:textArea name="outros" cols="80" rows="3" value="${historiaPregressaInstance?.outros}" />
                                </td>
                            </tr>
                            
                        </tbody>
                    </table>
                    <h2><g:message code="historiaPregressa.terapia.titulo" /></h2>
                    <table width="100%">
                        <tbody>
                        	 <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'tombolise', 'errors')}">
                                    <g:checkBox name="tombolise" value="${historiaPregressaInstance?.tombolise}" onclick="checkTrombolise(this.checked)" /> <label for="tombolise"><g:message code="historiaPregressa.tombolise.label" default="tombolise" /></label>
                                </td>
		                        <td colspan="2">
		                        <table name="tromboliseTable" id="tromboliseTable" <g:if test="${historiaPregressaInstance?.tombolise != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" >
                                	<tr>
                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'tomboliseData', 'errors')}" nowrap="nowrap">
			                            <calendar:datePicker name="tomboliseData" value="${historiaPregressaInstance?.tomboliseData}" showTime="true" dateFormat="${dateTimeFormat}" weekNumbers="false" years="${startYear},${endYear}" />
			                        </td>
                                	<td valign="middle" class="option">
		                        		<label for="trombolitico"><g:message code="historiaPregressa.trombolitico.label" default="trombolitico" /></label>
		                       		</td>
	                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'trombolitico', 'errors')}">
	                                    <g:select name="trombolitico" from="${historiaPregressaInstance.constraints.trombolitico.inList}" value="${historiaPregressaInstance?.trombolitico}" valueMessagePrefix="historiaPregressa.trombolitico" noSelection="['': '']"  />
	                                </td>
	                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'tromboliticoDose', 'errors')}" nowrap="nowrap">
	                                    <label for="tromboliticoDose"><g:message code="historiaPregressa.tromboliticoDose.label" default="dose" /></label>: <g:textField name="tromboliticoDose" value="${historiaPregressaInstance?.tromboliticoDose}" size="5" />
	                                </td>
	                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'tromboliticoSucesso', 'errors')}" nowrap="nowrap">
	                                    <label for="tromboliticoSucesso"><g:message code="historiaPregressa.tromboliticoSucesso.label" default="Com sucesso?" /></label> 
	                                    <g:checkBox name="tromboliticoSucesso" value="${historiaPregressaInstance?.tromboliticoSucesso}" />
	                                </td>
	                                </tr>
                                </table>
                                </td>
                            </tr>
                            <tr class="">
                            	<td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'atc', 'errors')}">
                                    <g:checkBox name="atc" value="${historiaPregressaInstance?.atc}" onclick="checkAtc(this.checked)" /> <label for="atc"><g:message code="historiaPregressa.atc.label" default="atc" /></label>
                                </td>
                                <td colspan="2">
	                            <table name="atcTable" id="atcTable" <g:if test="${historiaPregressaInstance?.atc != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" >
                                	<tr>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'atcData', 'errors')}" nowrap="nowrap">
				                            <calendar:datePicker name="atcData" value="${historiaPregressaInstance?.atcData}" showTime="true" dateFormat="${dateTimeFormat}" weekNumbers="false" years="${startYear},${endYear}" />
				                        </td>
				                        <td valign="middle" class="option">
				                        	<label for="deltaT"><g:message code="historiaPregressa.deltaT.label" default="deltaT" /></label>
				                        </td>
		                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'deltaT', 'errors')}">
		                                    <g:textField name="deltaT" value="${historiaPregressaInstance?.deltaT}" />
		                                </td>
		                            </tr>
		                      	</table>
		                      	</td>
                            </tr>
                            <tr class="">
                                <td valign="middle" class="option ${hasErrors(bean: historiaPregressaInstance, field: 'atcComplementar', 'errors')}">
                                    <g:checkBox name="atcComplementar" value="${historiaPregressaInstance?.atcComplementar}" onclick="checkAtcComplementar(this.checked)" /> <label for="atcComplementar"><g:message code="historiaPregressa.atcComplementar.label" default="ATC Complementar" /></label>
                                </td>
                                <td colspan="2">
	                            <table name="atcComplementarTable" id="atcComplementarTable" <g:if test="${historiaPregressaInstance?.atcComplementar != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" >
	                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'atcDataComplementar', 'errors')}" nowrap="nowrap">
			                            <calendar:datePicker name="atcDataComplementar" value="${historiaPregressaInstance?.atcDataComplementar}" showTime="true" dateFormat="${dateTimeFormat}" weekNumbers="false" years="${startYear},${endYear}" />
			                        </td>
			                        <td valign="middle" class="option">
			                        	<label for="deltaTComplementar"><g:message code="historiaPregressa.deltaTComplementar.label" default="dt Complementar" /></label>
			                        </td>
	                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'deltaTComplementar', 'errors')}">
	                                    <g:textField name="deltaTComplementar" value="${historiaPregressaInstance?.deltaTComplementar}" />
	                                </td>
                               	</table>
                               	</td>
                            </tr>
                    	</tbody>
                    </table>
                    
                    <h2><g:message code="historiaPregressa.ecg.titulo" /></h2>
                    <table width="100%">
                        <tbody>
                        	 <tr class="">
                                <td valign="middle" class="option">
                                    <label for="ritmo"><g:message code="historiaPregressa.ritmo.label" default="ritmo" /></label>
                                </td>
                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'ritmo', 'errors')}" nowrap="nowrap">
		                            <g:select name="ritmo" from="${historiaPregressaInstance.constraints.ritmo.inList}" value="${historiaPregressaInstance?.ritmo}" valueMessagePrefix="historiaPregressa.ritmo" noSelection="['': '']"  />
		                        </td>
		                        <td valign="middle" class="option">
		                        	<label for="bloqueio"><g:message code="historiaPregressa.bloqueio.label" default="bloqueio" /></label>
		                        </td>
                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'bloqueio', 'errors')}">
                                    <g:select name="bloqueio" from="${historiaPregressaInstance.constraints.bloqueio.inList}" value="${historiaPregressaInstance?.bloqueio}" valueMessagePrefix="historiaPregressa.bloqueio" noSelection="['': '']"  />
                                </td>
                            </tr>
                            <tr class="">
                                <td valign="top" class="option">
                                    <g:message code="historiaPregressa.alteracaoEcg.label" default="ecg" />
                                </td>
                                <td colspan="3">
                                	<table class="transp" cellspacing="0" cellpadding="0" width="50%">
                                	<tr>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'alteracaoSupra', 'errors')}" nowrap="nowrap">
		                                    <g:checkBox name="alteracaoSupra" value="${historiaPregressaInstance?.alteracaoSupra}" onclick="checkSupra(this.checked)" /> <label for="alteracaoSupra"><g:message code="historiaPregressa.alteracaoSupra.label" default="alteracaoSupra" /></label>
		                                </td>
		                                <td colspan="2">
		                                	<table name="supraTable" id="supraTable" <g:if test="${historiaPregressaInstance?.alteracaoSupra != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" width="50%">
				                                <td valign="middle" class="">
						                        	<label for="devivacaoSupra"><g:message code="historiaPregressa.devivacaoSupra.label" default="devivacaoSupra" /></label>
						                        </td>
				                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'devivacaoSupra', 'errors')}">
				                                    <g:textField name="devivacaoSupra" value="${historiaPregressaInstance?.devivacaoSupra}" size="50" />
				                                </td>
				                           	</table>
			                           	</td>
	                                </tr>
	                                <tr>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'alteracaoInfra', 'errors')}" nowrap="nowrap">
		                                    <g:checkBox name="alteracaoInfra" value="${historiaPregressaInstance?.alteracaoInfra} onclick="checkInfra(this.checked)" /> <label for="alteracaoInfra"><g:message code="historiaPregressa.alteracaoInfra.label" default="alteracaoSupra" /></label>
		                                </td>
		                                <td colspan="2">
		                                	<table name="infraTable" id="infraTable" <g:if test="${historiaPregressaInstance?.alteracaoInfra != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" width="50%">
				                                <td valign="middle" class="">
						                        	<label for="devivacaoInfra"><g:message code="historiaPregressa.devivacaoInfra.label" default="devivacaoInfra" /></label>
						                        </td>
				                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'devivacaoInfra', 'errors')}">
				                                    <g:textField name="devivacaoInfra" value="${historiaPregressaInstance?.devivacaoInfra}" size="50" />
				                                </td>
		                                	</table>
			                           	</td>
	                                </tr>
	                                <tr>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'alteracaoInversao', 'errors')}" nowrap="nowrap">
		                                    <g:checkBox name="alteracaoInversao" value="${historiaPregressaInstance?.alteracaoInversao}" onclick="checkInversao(this.checked)" /> <label for="alteracaoInversao"><g:message code="historiaPregressa.alteracaoInversao.label" default="alteracaoInversao" /></label>
		                                </td>
		                                <td colspan="2">
		                                	<table name="inversaoTable" id="inversaoTable" <g:if test="${historiaPregressaInstance?.alteracaoInversao != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" width="50%">
				                                <td valign="middle" class="">
						                        	<label for="devivacaoInversao"><g:message code="historiaPregressa.devivacaoInversao.label" default="devivacaoInversao" /></label>
						                        </td>
				                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'devivacaoInversao', 'errors')}">
				                                    <g:textField name="devivacaoInversao" value="${historiaPregressaInstance?.devivacaoInversao}" size="50" />
				                                </td>
		                                	</table>
			                           	</td>
	                                </tr>
	                                <tr>
	                                	<td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'alteracaoDelta', 'errors')}" nowrap="nowrap">
		                                    <g:checkBox name="alteracaoDelta" value="${historiaPregressaInstance?.alteracaoDelta}" onclick="checkDelta(this.checked)" /> <label for="alteracaoDelta"><g:message code="historiaPregressa.alteracaoDelta.label" default="alteracaoDelta" /></label>
		                                </td>
		                                <td colspan="2">
		                                	<table name="deltaTable" id="deltaTable" <g:if test="${historiaPregressaInstance?.alteracaoDelta != true}" > style="display:none" </g:if> class="transp" cellspacing="0" cellpadding="0" width="50%">
				                                <td valign="middle" class="">
						                        	<label for="devivacaoDelta"><g:message code="historiaPregressa.devivacaoDelta.label" default="devivacaoDelta" /></label>
						                        </td>
				                                <td valign="middle" class=" ${hasErrors(bean: historiaPregressaInstance, field: 'devivacaoDelta', 'errors')}">
				                                    <g:textField name="devivacaoDelta" value="${historiaPregressaInstance?.devivacaoDelta}" size="50" />
				                                </td>
		                                	</table>
			                           	</td>
	                                </tr>
	                                </table>
	                            </td>
	                         </tr>
                         </tbody>
                    </table>
                    
                    <g:if test="${historiaPregressaInstance.lastUpdated}">
	                <br>
	                <table width="100%">
	                	<tbody>
	                        <tr class="prop">
	                            <td valign="middle" class="name">Inserido por</td>
	                            <td valign="middle" class="value">
	                            	${historiaPregressaInstance?.createdBy?.nome} em <g:formatDate date="${historiaPregressaInstance?.dateCreated}" /></td>
	                            <td valign="middle" class="name">Atualizado por</td>
	                            <td valign="middle" class="value">
	                            	${historiaPregressaInstance?.updatedBy?.nome} em <g:formatDate date="${historiaPregressaInstance?.lastUpdated}" /></td>
	                        </tr>
	                    </tbody>
	               </table>
	               <br>
	               </g:if>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="${message(code: 'default.button.update.label', default: 'Update')}" /></span>
                </div>
            </g:form>
        </div>
        <br>
        <br>
    </body>
</html>
